package com.algo.config;

import com.algo.color.Red;
import com.algo.color.Yellow;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

public class MyImportBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar {

    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {

        BeanDefinition redBeanDefinition = new RootBeanDefinition(Red.class);
        registry.registerBeanDefinition("red", redBeanDefinition);

        BeanDefinition yellowBeanDefinition = new RootBeanDefinition(Yellow.class);
        registry.registerBeanDefinition("yellow", yellowBeanDefinition);
    }

}
